/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package src.services.customer;

/**
 *
 * @author Yusup Jauhari Shandi <in.visi>
 */

import java.util.List;
import java.util.Map;
import javax.faces.model.SelectItem;
import src.domain.customer.Cusper;
import src.domain.customer.Customer;
import src.services.CRUEDService;

public class CusperModel  implements  java.io.Serializable{
    private CRUEDService service;

    public CusperModel() {
      service =new CRUEDService();
    }
      
    public List<Cusper> findAll(Map<String, String> filters) {
        return (List<Cusper>) this.service.findAll("Cusper", filters);
    }
    
    public List<Cusper> findAllAdvance(Map<String, Object> filters) {
        return (List<Cusper>) this.service.findAllSQLAdvance("from Cusper tb ", filters," order by tb.customer.cif");
    }
    
    public List<SelectItem> listAll() {
        return this.service.listAll("Cusper", "CustomerId", "CustomerName");
    }
    
    public boolean saveData(Customer  data) {
        return this.service.saveData(data);
    }    
    
    public boolean deleteData(Customer  data) {
        return this.service.deleteData(data);
    }
      
}
